Skip to content

feat(desktop): Chat 会话支持重命名并显示进行中状态 - #141

Merged
Fairy-happy merged 3 commits into
V1.3.0from
feat/v130-chat-rename-running
Nov 11, 2026
Merged

Fairy-happy merged 3 commits into
V1.3.0from
feat/v130-chat-rename-running

Conversation

@codesstar

@codesstar codesstar commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Chat 模式梳理中的两项:云端会话不能重命名,进行中的会话没有进度提示。Work 会话行两者都有,Chat 行原先只有“移入项目 / 删除”。(替代 #138:#136 已合入,本 PR 直接基于 V1.3.0,只含本次改动。)

重命名

  • 云端会话行菜单新增“重命名”,双击标题同样打开,交互对齐 Work 的会话重命名:弹窗预填原名并全选、空名不可提交、输入法组字时回车不提交、保存中锁定关闭、失败保留草稿并可重试。弹窗打开期间原生 Chat 视图让出显示区域,与删除确认一致。
  • 侧栏显示云端会话的三处都可重命名:“对话”历史、项目分页、搜索结果。
  • 主进程调用毕昇现有 POST /api/v1/chat/conversation/rename,沿用删除的授权方式:可信窗口与主 frame、当前账号代际、会话须已出现在本账号当前的历史或项目 / 搜索读取结果中(主进程 routes)。名称按 message_session.name 校验(去首尾空白后 1–255 字符,不含控制字符)。成功后通知嵌入网页重新读取会话名;失败不通知。
  • 成功后侧栏同时更新三处的标题与时间:历史列表本地更新后重读;项目分页按创建时间排序、改名不改变位置,因此就地更新而不重读(重读只取第一页,会让后续页中的会话暂时消失)。改名前发出、改名后才返回的项目分页或搜索结果不会带回旧名;改名后发出的读取以服务端为准。

进行中提示

  • 嵌入网页通过 dshChatPresentation.reportRunning 上报仍在生成的会话。主进程只接受当前主 frame、当前路径(report.path === url.pathname,在 ipc-message 入口对所有上报统一校验)的上报,按 id 格式与数量(≤100)校验,文档重载或账号变化时清空。进行中状态仅用于展示,不参与授权。
  • 云端会话行(历史、项目分页、搜索结果)在左侧状态位显示与 Work 相同的 StateDot 进行中图标(沿用其减少动态效果处理),悬停卡片同步显示“进行中”,并通过 aria-describedby 提供读屏文案。
  • 上报来自网页端配套 PR feat(client): 向桌面客户端同步会话进行中状态与重命名 bisheng#2649(已合入 feat/3.1.0-beta1)。未升级的网页不会上报,客户端保持现状、不报错。

基于 V1.3.0@a17dc3cd。

验证

  • npm run typecheck、npm run build、git diff --check 通过;npm test 完整回归 355 个文件:3,667 项通过,5 项按环境条件跳过,0 失败。
  • 新增 test/cloud-chat-rename-running.test.mjs(真实 primitives):菜单 / 双击打开、组字、失败重试、账号切换丢弃;项目分页中不在已加载历史页的旧会话、三类搜索结果(不在历史且无项目 / 有项目但不在历史 / 同时在历史)改名后行标题更新;改名前发出的项目分页或搜索结果晚到不带回旧名,改名后的读取以服务端为准;进行中图标在历史、项目分页、搜索结果三处显示。项目 / 搜索相关的 6 条在修复前的实现上全部失败。
  • test/enterprise-chat-view.test.ts 补主进程契约:改名成功与通知;越权、非法 / 超长名称、控制字符、失败响应、登出丢弃;只由项目分页或搜索结果列出的会话可以改名(去掉 projectConversations 的路由登记时这两条失败)。进行中上报覆盖非主 frame、路径不符、伪造 id、非数组、超量;拒绝用例显式从主 frame 发送,确保执行到路径和列表校验(逐项去掉主 frame、路径、id、数量检查时,各只有对应一条失败)。
  • test/desktop-modes-ui.test.mjs 补弹窗期间原生视图让位;菜单项断言由 ['Move to project', 'menu'] 改为 ['rename', 'Move to project', 'menu'](新契约:云端行菜单以重命名开头,与 Work 一致)。test/desktop-client-ui.test.ts 的槽位注册列表多一个 shell.overlay(重命名弹窗)。搜索夹具、账号展示夹具同步新增的 renaming 与 running 字段。

真实环境(macOS 开发版,109 测试服务器,2026-11-11,基于本 PR 当前提交)

  • 历史行菜单重命名:菜单为“重命名 / 移入项目 / 删除”;弹窗 aria-modal,预填原名并全选;弹窗期间嵌入 Chat 页面 visibilityState 为 hidden,关闭后恢复 visible;名称去首尾空白后写入服务端(经 history 重读确认,update_time 同步更新),侧栏行即时更新。
  • 搜索结果行重命名后搜索行即时更新(109 的服务端搜索返回 404,结果来自已加载历史)。双击标题打开、Esc 取消,并经双击改回原名。
  • 主进程对控制字符、超长名称、未列出的会话、过期代际直接拒绝,未请求服务端。
  • 进行中:在嵌入页面调用真实桥接 dshChatPresentation.reportRunning,对应行出现 StateDot 与读屏文案“进行中”,图标不遮挡标题;伪造 id 被拒(日志 invalid_running_report)并保持原列表;清空后消失。
  • 2026-11-09 另验证过:接入本地构建的配套网页后,发送消息时会话行出现进行中图标、回答结束后消失;嵌入网页收到改名通知。
  • 109 不支持项目同步(/api/v1/chat/projects/* 返回 404),项目分页与服务端搜索结果的改名只有自动化测试覆盖,未做真实环境验证。

未完成 / 已知限制

  • Windows 安装版验收;配套网页部署后的正式环境验收。
  • 改名属于项目的会话时,服务端会递增项目 revision,此前取得的分页游标随之失效,随后“加载更多”会提示读取失败,点重试后恢复。这是服务端游标与 revision 绑定的既有行为,网页端改名、首条消息自动命名同样会触发,本 PR 未改动。
  • 更正:服务端改名接口在 feat/3.1.0-beta1 上已校验会话归属(53afe2a71),早先描述中“未校验”的说法有误。

Cloud Chat rows only offered move and delete. They now rename like Work
rows: a Rename menu item and a title double-click open a dialog that posts
to BiSheng's existing POST /api/v1/chat/conversation/rename under the same
history grant deletion uses. The main process validates the name against
message_session.name (1-255 characters, no control characters) and tells
the open enterprise document so it can reread the conversation name. The
native Chat view yields while the dialog is open, as for deletion.

The enterprise document can now report which conversations are still
generating (reportRunning). The host validates the report from the current
main frame, keeps it per document and identity, and the sidebar shows the
same ongoing StateDot as Work rows with a screen-reader label. Older
documents that never report leave the list unchanged.

Tests: rename and activity contracts in enterprise-chat-view, real-primitive
dialog/row coverage in cloud-chat-rename-running, native view yielding in
desktop-modes-ui; fixtures updated for the new overlay and navigation fields.
…results

Project pages and the current search keep their own copies of a conversation,
so a rename now updates them in place (they are ordered by creation time and
are not reread). A page requested before the rename finished keeps the new
name. Every row the sidebar shows can open the rename dialog; the host still
checks its own routes.
@codesstar
codesstar force-pushed the feat/v130-chat-rename-running branch from 317b702 to 3d66574 Compare November 11, 2026 10:12
@Fairy-happy
Fairy-happy merged commit e9a5ca6 into V1.3.0 Nov 11, 2026
3 checks passed
@Fairy-happy
Fairy-happy deleted the feat/v130-chat-rename-running branch November 11, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants